package com.wkm.myapplication.vp

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.wkm.myapplication.R

/**
 * TODO 简要描述
 * @author chaochaowu @ Zebra Inc.
 * @since 12-27-2021
 */
class Fragment1 : Fragment() {
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        val v1 = inflater.inflate(R.layout.fragment1, null)
        val recyclerView1 = v1.findViewById<MyRecyclerView>(R.id.rv)
        val list = ArrayList<Object>()
        repeat(15) {
            list.add(Object())
        }

        val adapter = RVAdapter(requireActivity(), list)
        recyclerView1.adapter = adapter
        recyclerView1.layoutManager = LinearLayoutManager(requireContext())
        adapter.notifyDataSetChanged()
        return v1
    }
}


class Fragment2 : Fragment() {
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        val view2 = requireActivity().layoutInflater.inflate(R.layout.image, null)
        return view2
    }
}